let id = getQueryString('productid')
console.log(id);

fetch(`http://chst.vip:1234/api/getproduct?productid=` + id)
    .then(body => body.json())
    .then(res => {
        res = res.result
        // console.log(res);
        let regExp = /^<[^<]+\s+src="([^''""]*)"/
        let mate = regExp.exec(res[0].productImg)
        // console.log(mate[1]);
        let str = `
        <div class="container">
            <img src=${mate[1]} class="contImg">
            <h2>${res[0].productName}</h2>
            ${res[0].bjShop}
        </div>`
        $('.content').html(str)
        // console.log(str);
    })

fetch(`http://chst.vip:1234/api/getproductcom?productid=` + id)
    .then(body => body.json())
    .then(res => {
        // res = res.result
        // console.log(res);
        let pStr = ''
        res.result.map(items => {
            console.log(items);
            pStr += `
            <li>
            <h4>
                ${items.comName}
                <span>${items.comTime}</span>
            </h4>
            <p>
                ${items.comContent}
            </p>
            </li>
            `
        })
        $('.comment ul').html(pStr)
        location.href = "/移动端项目/项目基本结构/html/product.html?productid=" + id
    })